<?php 
include("inc/smarty.php");
include("inc/common.inc.php");
include("menu.php");
date_default_timezone_set('Asia/Chongqing');//设置时区
$typeid=$_GET['aid'];
$pages=$_GET['pages'];
isnum($typeid,"对不起，没有找到该页面！",$web_info['website_root']);
if(!is_numeric($pages)||$pages<=0){
	ShowMsg_h("对不起，没有找到该页面！",$web_info['website_root']);
	exit;
}
$pages--;


$sql=select_sql("`id`,`typename`","`".PRETABLE."arctype`","`id`='".$typeid."'");
$rs=$db->query($sql) or die("datebase error!");
if(!$rs->num_rows){
	ShowMsg_h("对不起，没有找到该页面！",$web_info['website_root']);
	exit;
}
$typename=$rs->fetch_assoc();


$type_list=array();
$sql=select_sql("*","`".PRETABLE."arcmain`","`isdel`='0' AND `ishidden`='0' AND `typeid`='".$typeid."' ORDER BY `pubdate` DESC");
$rs=$db->query($sql) or die("datebase error!");
$arc_count=$rs->num_rows;//文档总数
while($row=$rs->fetch_assoc()){
	$type_list[]=$row;
}

$pages_size=6;//每页显示文档数
$pages_num=$arc_count%$pages_size?(int)($arc_count/$pages_size)+1:(int)($arc_count/$pages_size);
$smarty->assign("typename",$typename['typename']);
$smarty->assign("typelist",$type_list);
$smarty->assign("typeid",$typeid);
$smarty->assign("pages",$pages);
$smarty->assign("max",$pages_size);
$smarty->assign("count",$arc_count);//文档总数
$smarty->assign("pages_num",$pages_num);//总页数
$rs->close();
$db->close();
$smarty->display("list.htm");
?>